import { playVideo, searchvideo } from '@/api/video'
import { deletevideo } from '@/api/video'

const state = {

}

const mutations = {

}

const actions = {
  // user login
  searchvideo({ commit }, param) {
    // const { startData, name, endData } = param
    // const { username, password } = userInfo
    return new Promise((resolve, reject) => {
      searchvideo(param).then(response => {
        resolve(response)
      }).catch(error => {
        reject(error)
      })
    })
  },
  // 删除视频
  deletevideo({ commit }, param) {
    return new Promise((resolve, reject) => {
      deletevideo(param).then(response => {
        resolve(response)
      }).catch(error => {
        reject(error)
      })
    })
  },
  // 播放视频
  playvideo({ commit }, param) {
    return new Promise((resolve, reject) => {
      playVideo(param).then(response => {
        resolve(response)
      }).catch(error => {
        reject(error)
      })
    })
  }

}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}

